<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=1440, minimum-scale=0.1, maximum-scale=10, user-scalable=no" />
    <meta name="color-scheme" content="light" />
    <meta name="full-screen" content="yes" />
    <link rel="icon" href="favicon.ico" />
    <title>中数智算</title>
  </head>
  <body>
    <script src="./lib/qrcode.min.js"></script>
    <script src="./lib/vue.global.min.js"></script>
    <link rel="stylesheet" href="./lib/element-plus/index.css" />
    <script src="./lib/element-plus/index.full.min.js"></script>
    <script src="./lib/element-plus/locale/zh-cn.js"></script>
    <script src="./lib/Application.umd.js"></script>
    <script src="./lib/apiDoc.js"></script>

    <!-- 人员添加组件 -->
    <template id="DesignWorker">
      <div class="worker-add-view flex-column" v-loading="loading">
        <div class="flex-row-between">
          <div class="width-50 flex-column">
            选择
            <el-card class="" shadow="never">
              <el-input placeholder="搜索员工">
                <template #prefix>
                  <Icon icon="search"></Icon>
                </template>
              </el-input>
              <div style="margin: 5px 0">
                <el-button-group>
                  <el-button @click="qr = false">组织架构</el-button>
                  <el-button type="primary" @click="qr = true">二维码邀请</el-button>
                </el-button-group>
              </div>
              <div v-show="qr" class="text-center">
                <div class="qr">
                  <Qr-Code text="http://localhost:3001/#/ProjectManage"></Qr-Code>
                  <div class="text text-large">xx公司</div>
                  <div class="text">xx项目</div>
                </div>
                <div><el-button type="primary">下载二维码</el-button></div>
              </div>
              <div v-show="!qr">
                <el-tree :data="data" :props="props" default-expand-all show-checkbox :expand-on-click-node="false" :height="208"></el-tree>
              </div>
            </el-card>
          </div>
          <div class="width-50 flex-column">
            已选
            <el-card shadow="never"></el-card>
          </div>
        </div>

        <div class="dialog-action text-right">
          <el-button @click="cancel">取消</el-button>
          <el-button type="primary" @click="save">确认</el-button>
        </div>
      </div>
    </template>
    <script>
      var DesignWorker = {
        extends: BaseComponent,
        template: "#DesignWorker",
        name: "DesignWorker",
        props: ["design"],
        emits: ["close"],
        data() {
          return {
            qr: false,
            props: {
              value: "value",
              label: "name",
              children: "children"
            },
            options: [
              { label: "张三", value: "张三" },
              { label: "张三1", value: "张三1" },
              { label: "张三2", value: "张三2" },
              { label: "张三3", value: "张三3" }
            ],
            loading: false,
            form: this.design || {},
            rules: [],
            g: [
              {
                name: "数字员工",
                children: [
                  { name: "数字状态", children: [] },
                  { name: "工作记录", children: [] }
                ]
              }
            ]
          };
        },
        computed: {
          data() {
            return [
              {
                name: "部门1",
                value: "部门1",
                children: [{ name: "员工1", value: "员工1" }]
              },
              {
                name: "部门2",
                value: "部门2",
                children: [{ name: "员工1", value: "员工1" }]
              }
            ];
          },
          checkAll() {
            return 0;
          },
          groups() {
            return [
              {
                name: "数字员工",
                children: [
                  { name: "数字状态", children: [] },
                  { name: "工作记录", children: [] }
                ]
              }
            ];
          }
        },
        created() {
          // this.getData();
        },

        methods: {
          isIndeterminate() {},
          handleCheckAllChange() {},
          cancel() {
            this.$emit(`close`);
          },
          save() {
            this.loading = true;
            this.$g.ajax.$api("member.save", this.form).then((result) => {
              console.log(result);
              this.loading = false;
              this.$g.toast(result.message, result.code == 0 ? "success" : "error");
              this.cancel();
            });
          }
        }
      };
    </script>
    <style>
      .qr {
        background: #ffffff;
        border-radius: 8px 8px 8px 8px;
        padding: 20px;
        margin: 20px 0;
      }
      .qr .qr-code {
        width: 160px;
        height: 160px;
        margin-bottom: 10px;
      }
      .qr .text {
        padding: 5px;
      }
      .text-large {
        font-size: 1.4em;
      }
      .worker-add-view {
        overflow: auto;
      }
      .worker-add-view .el-tree {
      }
      .worker-add-view .width-50 {
        height: 500px;
        width: 49%;
      }

      .worker-add-view .el-card {
        background-color: rgb(246, 246, 246);
        padding: 10px;
        flex-grow: 1;
      }
      .dialog-action {
        margin-top: 20px;
      }
    </style>

    <!-- 人员管理组件 -->
    <template id="MemberAdd">
      <div class="member-add flex-column" v-loading="loading">
        <el-form :model="form" :rules="rules" :label-width="100">
          <el-form-item label="部门成员" prop="user" class="worker">
            <Icon icon="plus" class="worker-add click" @click="setDesign({})"></Icon>
            <el-select-v2
              class="width-100"
              v-model="form.user"
              :options="options"
              multiple
              clearable
              collapse-tags
              collapse-tags-tooltip
              :max-collapse-tags="9"
              placeholder="请输入用户账号"
            >
              <template #prefix><span></span></template>
            </el-select-v2>
          </el-form-item>
          <el-form-item label="设立主管" prop="password">
            <el-radio-group v-model="form.auth" class="">
              <el-radio label="1">是</el-radio>
              <el-radio label="2">否</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="管理权限" prop="username">
            <el-radio-group v-model="form.auth" class="">
              <el-radio label="1">可分配</el-radio>
              <el-radio label="2">不可分配</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="员工职位" prop="username">
            <el-radio-group v-model="form.auth" class="">
              <el-radio label="1">总监</el-radio>
              <el-radio label="2">专监</el-radio>
              <el-radio label="3">资料员</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="功能权限" prop="username">
            <div class="flex-row-between card-permission">
              <el-card class="" shadow="never">
                <div v-for="group in groups" :key="group">
                  <el-checkbox v-model="group.selected" :indeterminate="isIndeterminate()" @change="handleCheckAllChange">
                    {{ group.name }}
                  </el-checkbox>
                  <div v-for="item in group.children" :key="item">
                    <el-space class="" :size="40">
                      <el-checkbox class="margin-right-10px" v-model="item.selected">{{ item.name }}</el-checkbox>
                      <el-radio-group v-model="item.auth" class="">
                        <el-radio label="1">可查看</el-radio>
                        <el-radio label="2">可编辑</el-radio>
                      </el-radio-group>
                    </el-space>
                  </div>
                </div>
              </el-card>
              <el-card shadow="never">
                <div v-for="group in groups" :key="group">
                  <el-checkbox v-model="group.selected" :indeterminate="isIndeterminate()" @change="handleCheckAllChange">
                    {{ group.name }}
                  </el-checkbox>
                  <div v-for="item in group.children" :key="item">
                    <el-space class="" :size="40">
                      <el-checkbox class="margin-right-10px" v-model="item.selected">{{ item.name }}</el-checkbox>
                      <el-radio-group v-model="item.auth" class="">
                        <el-radio label="1">可查看</el-radio>
                        <el-radio label="2">可编辑</el-radio>
                      </el-radio-group>
                    </el-space>
                  </div>
                </div>
              </el-card>
            </div>
          </el-form-item>

          <div class="form-action text-center">
            <el-button @click="cancel">取消</el-button>
            <el-button type="primary" @click="save">确认</el-button>
          </div>
        </el-form>
        <el-dialog
          width="860px"
          title="人员管理"
          :close-on-press-escape="false"
          :close-on-click-modal="false"
          :model-value="designWorker ? true : false"
          @close="setDesign()"
        >
          <Design-Worker v-if="designWorker" :design="design" @close="setDesign()"></Design-Worker>
        </el-dialog>
      </div>
    </template>
    <script>
      var MemberAdd = {
        extends: BaseComponent,
        template: "#MemberAdd",
        components: { DesignWorker },
        name: "MemberAdd",
        props: ["design"],
        emits: ["close"],

        data() {
          return {
            loading: false,
            form: this.design || {},
            designWorker: null,
            options: [
              { label: "张三", value: "张三" },
              { label: "张三1", value: "张三1" },
              { label: "张三2", value: "张三2" },
              { label: "张三3", value: "张三3" }
            ],
            loading: false,
            form: this.design || {},
            rules: [],
            groups: [
              {
                name: "数字员工",
                children: [
                  { name: "数字状态", children: [] },
                  { name: "工作记录", children: [] }
                ]
              }
            ],
            rules: {
              zgu_name: [
                {
                  required: true,
                  message: "请输入"
                }
              ],
              zgu_userName: [
                {
                  required: true,
                  message: "请输入"
                  // validator(rule, value, callback) {
                  //   callback();
                  // }
                }
              ]
            }
          };
        },
        computed: {
          treeSelectData() {
            return [
              {
                name: "主管部门",
                value: "主管部门",
                children: [{ name: "四川省", value: "四川省", children: [{ name: "成都市", value: "成都市" }] }]
              },
              {
                name: "参建单位",
                value: "参建单位",
                children: [{ name: "监理单位", value: "监理单位" }]
              }
            ];
          }
        },
        created() {
          // this.getData();
        },
        methods: {
          setDesign(design) {
            this.designWorker = design;
          },
          isIndeterminate() {},
          handleCheckAllChange() {},
          cancel() {
            this.$emit(`close`);
          },

          save() {
            this.$refs.formRef.validate((valid) => {
              if (valid) {
                let param = this.form;
                let key = param.zgu_id ? "sq_org.UpdateGorvermentAdmin" : "sq_org.InsertGorvermentAdmin";
                param.zg_id = window.zg_id; //部门id
                this.loading = true;
                this.$g.ajax.$api(key, param).then((result) => {
                  console.debug("[save]", result, param);
                  this.loading = false;
                  this.$g.toast(result.msg, result.status == "success" ? "success" : "error");
                  result.status == "success" && this.$emit(`close`, "reFresh");
                });
              } else {
                // this.$g.toast(result.msg, result.status == "success" ? "success" : "error");
                return false;
              }
            });
          }
        }
      };
    </script>
    <style>
      .member-add {
        border-radius: 8px 8px 8px 8px;
        position: absolute;
        inset: 0;
        left: 0;
        right: 0;
        bottom: 0;
        top: 0;
        background: white;
        z-index: 9;
        padding: 20px 0;
        overflow: auto;
        margin: 10px;
      }
      .member-add .el-form {
        max-width: 900px;
      }
      .card-permission {
        width: 100%;
      }
      .card-permission .el-card {
        background-color: rgb(246, 246, 246);
        width: 49%;
        padding: 10px;
      }
      .el-form-item__content {
        position: relative;
      }
      .worker-add {
        position: absolute;
        z-index: 100;
        left: 5px;
      }
      .worker .el-select-v2__wrapper {
        padding-left: 10px;
      }
    </style>
    <!-- 管理页面 -->
    <template id="TeamManage">
      <div class="team-manage flex-column app-page" v-loading="loading">
        <!-- <div class="page-head action-bar flex-row-between flex-row-center">
          <div>团队名称 : {{ $g.session.data || "无" }}</div>
          <el-button type="primary" @click="setDesign({})">成员添加</el-button>
        </div> -->
        <div class="page-body flex-row-between">
          <!-- <div>
            <div class="title">功能列表</div>
            <div class="view">
              <div><el-input></el-input></div>
              <el-tree :data="data" :props="props" default-expand-all show-checkbox :expand-on-click-node="false" :height="208"></el-tree>
            </div>
          </div> -->
          <div class="function-custom flex-column">
            <div class="title flex-row-between flex-row-center">
              公司-组织架构图
              <el-space>
                <el-button type="primary" @click="setActiveAdd({},'部门')">部门添加</el-button>
                <el-button type="primary" color="#3159FC" @click="setActiveAdd({},'公司')">监理机构添加</el-button>
              </el-space>
            </div>
            <Graph
              class="graph-view"
              :data="graphData"
              :config="{
                nodeHeight: 80,
                nodeWidth: 180,
                marginX: 60
              }"
            >
              <template #node="{ node, data }">
                <div
                  class="node-card flex-column click"
                  :id="'node' + node.id"
                  :class="{
                    team: data.type == '项目',
                    'node-active': data == active
                  }"
                  @click="setActive(data)"
                  :draggable="true"
                  @dragover.prevent=""
                  @dragstart="dragStart($event, data)"
                  @drop="drop($event,data)"
                >
                  <div class="node-card-header flex-row-between flex-row-center">
                    <el-space>
                      <Icon :icon="data.type == '项目' ? 'Xiangmu' : 'Bumen'"></Icon>
                      {{ data.name }}
                    </el-space>
                    <Icon icon="close" class="click"></Icon>
                  </div>
                  <div class="node-card-body flex-column">
                    <div class="flex-row-between flex-row-center" style="flex-grow: 1">
                      <div v-if="data.userList &&data.userList.length" class="text-nowrap">{{data.userList.join(' , ')}}</div>
                      <span v-else class="gray">{{"员工添加" }}</span>
                      <Icon :icon=" 'ArrowRight'" class="gray"></Icon>
                    </div>
                  </div>
                  <div
                    class="node-card-expand"
                    v-if="node.children && node.children.length || data.childCount"
                    @click.stop="data.fold=!data.fold"
                  >
                    <Icon :icon="data.childCount && !node.children?'plus':'SemiSelect'" :size="10"></Icon>
                  </div>
                </div>
              </template>
            </Graph>
          </div>

          <div v-if="activeDesign" class="struct-item-preview" :class="expand ? '' : 'view-hide'">
            <div class="view-trigger flex-column-center click" @click="expand = !expand">
              {{ expand ? "收起" : "展开" }}
              <Icon icon="Zhankai-Ssuo" class="click"></Icon>
            </div>
            <div class="abs view-detail">
              <div class="title flex-row-between flex-row-center">部门信息</div>
              <div class="view">
                <div class="title flex-row-between flex-row-center">
                  <el-space>
                    <span>部门名称</span>
                    <el-input v-model="activeDesign.dep_name" placeholder="请输入"></el-input>
                    <!-- <el-select model-value="1">
                      <el-option value="1" label="部门1"></el-option>
                    </el-select> -->
                    <el-button type="primary" @click="save()" plain="">保存</el-button>
                  </el-space>
                </div>
                <div class="title flex-row-between flex-row-center">
                  <span>员工列表</span>
                  <el-space>
                    <el-button type="primary" @click="setDesign({})" round="">
                      <el-space :size="2">
                        <Icon icon="plus" class="click"></Icon>
                        员工添加
                      </el-space>
                    </el-button>
                  </el-space>
                </div>
                <el-table :data="tableData" border="" stripe="">
                  <el-table-column type="index" label="#" width="50px" :resizable="false" align="center"></el-table-column>
                  <el-table-column prop="name" label="员工姓名" align="center"></el-table-column>
                  <el-table-column prop="" label="设立主管" align="center"></el-table-column>
                  <el-table-column prop="" label="管理权限" align="center"></el-table-column>
                  <el-table-column prop="" label="功能权限" width="360px" align="center" :resizable="false">
                    <template #default="scoped">
                      <el-space :size="10">
                        <span>
                          功能总数
                          <span class="info">30个</span>
                        </span>
                        <span>
                          可读数
                          <span class="info">12个</span>
                        </span>
                        <span>
                          可编辑数
                          <span class="info">18个</span>
                        </span>
                      </el-space>
                    </template>
                  </el-table-column>
                  <el-table-column prop="" label="操作" width="140px" align="center" :resizable="false" fixed="right">
                    <template #default="scoped">
                      <el-button type="primary" plain size="small" @click="setDesign(scoped.row)">编辑</el-button>
                      <el-button type="danger" plain size="small" @click="remove(scoped.row)">删除</el-button>
                    </template>
                  </el-table-column>
                </el-table>
              </div>
            </div>
          </div>
        </div>
        <Member-Add v-if="design" :design="design" @close="setDesign()"></Member-Add>

        <!-- <el-dialog
          width="960px"
          :title="design && design.id ? '部门编辑' : '部门创建'"
          :close-on-press-escape="false"
          :close-on-click-modal="false"
          :model-value="design ? true : false"
          @close="setDesign()"
        >
         
        </el-dialog> -->
      </div>
    </template>
    <script>
      window.sc_id = new URLSearchParams(location.search).get("sc_id"); //部门id
      if (!window.sc_id) {
        ElementPlus.ElNotification({ title: "错误信息", message: "没有公司id", type: "error" });
      }
      var TeamManage = {
        template: "#TeamManage",
        extends: BaseComponent,
        name: "TeamManage",
        components: { MemberAdd },
        data() {
          return {
            loading: false,
            expand: true,
            design: null,
            active: null,
            activeAdd: null,
            result: null,
            props: {
              value: "value",
              label: "name",
              children: "children"
            }
          };
        },
        computed: {
          activeDesign() {
            return this.activeAdd || this.active;
          },
          tableData() {
            return [{ name: "用户1" }, { name: "用户2" }, { name: "用户3" }];
          },
          graphData() {
            let nodeMap = {};
            let data = (this.result || {}).data || [];
            let time = Date.now();
            let childrenHide = {};
            data.map((item) => {
              let t = Date.now();
              if (item.fold) {
                childrenHide[item.id] = item;
                item.childCount = 0;
              }
              nodeMap[item.id] = item;
            });

            // console.log("[节点过滤]cache耗时", Date.now() - time, "节点数", data.length, (time = Date.now()));
            let n = 0;
            function nodesHide(hides, map) {
              let t = Date.now();
              hides = hides || {};
              let hidesNext = {};
              for (const i in map) {
                let item = map[i];
                if (!item) {
                  continue;
                }
                let parent = hides[item.pid];
                if (parent) {
                  delete nodeMap[item.id];
                  hidesNext[item.id] = item;
                  parent.childCount = (parent.childCount || 0) + 1;
                }
              }
              let childCount = Object.keys(hidesNext).length;
              // console.log(`[节点过滤]递归${n++}耗时`, hidesNext, childCount, Date.now() - t, (t = Date.now()));
              childCount && nodesHide(hidesNext, map);
            }
            nodesHide(childrenHide, nodeMap);
            // console.log("[节点过滤耗时]", Date.now() - time, childrenHide, nodeMap);

            return nodeMap;
            //((this.result || {}).data || []).filter((item) => item.fold != true);
            [
              {
                id: 1,
                name: "部门",
                type: 1
              },
              {
                id: 2,
                pid: 1,
                name: "部门1",
                type: 1
              },
              {
                id: 3,
                pid: 1,
                name: "部门2",
                type: 1
              },
              {
                id: 4,
                pid: 1,
                name: "部门3",
                type: 1
              },
              {
                id: 5,
                pid: 3,
                type: 2,
                level: 3,
                name: "项目2"
              }
            ];
          },
          data() {
            return [
              {
                name: "数字员工",
                value: "数字员工",
                children: [{ name: "数字状态", value: "数字状态" }]
              },
              {
                name: "项目管控",
                value: "项目管控",
                children: [{ name: "项目信息", value: "项目信息" }]
              }
            ];
          }
        },
        created() {
          this.getData();
        },
        setup() {},
        methods: {
          dragStart(ev, data) {
            ev.dataTransfer.setData("designDrag", JSON.stringify(data));
          },
          drop(ev, data) {
            console.debug("[拖拽]", ev, data);
            try {
              let str = ev.dataTransfer.getData("designDrag");
              let data = JSON.parse(str);
              console.log("[drop][data]", data);
            } catch (error) {
              console.error("[ondrop][解析ev.dataTransfer异常]", error);
            }
          },
          save() {
            let param = this.activeDesign;
            console.log("[save]", param, this.active);
            param.sc_id = param.sc_id || window.sc_id || null;
            param.dep_parentId = ((this.active || {}).$data || {}).id || 1;
            let key = "sq_org.InsertTeam";
            this.loading = true;
            this.$g.ajax.$api(key, param).then((result) => {
              this.loading = false;
              console.log(key, result, param);
              this.getData();
            });
          },
          setActive(active) {
            this.active = active;
            this.activeAdd = null;
          },
          setActiveAdd(data, type) {
            this.activeAdd = { ...data, type };
            data && (this.expand = true);
          },
          setDesign(design) {
            this.design = design;
          },
          getData() {
            this.loading = true;
            this.$g.ajax.$api("sq_org.GetOrgNodes", { companyId: window.sc_id, depId: "" }).then((result) => {
              this.loading = false;
              console.log(result);
              this.result = result;
            });
          },
          remove(item) {
            this.$g.ajax.$api("team.remove", item).then((result) => {
              console.log(result);
            });
          }
        }
      };
    </script>
    <style>
      .team-manage {
        position: relative;
        overflow: visible;
        flex-grow: 1;
      }
      .title {
        padding: 10px;
        min-height: 56px;
        border-bottom: 1px solid #2f517e1f;
      }
      .view {
        padding: 10px;
      }
      .graph-view {
        overflow: auto;
        flex-grow: 1;
      }
      .function-custom {
        overflow: auto;
        flex-grow: 1;
        border: 1px solid #2f517e1f;
        border-top: none;
        border-bottom: none;
      }
      .node-card {
        position: absolute;
        inset: 0;
        left: 0;
        right: 0;
        bottom: 0;
        top: 0;
        --r: 8px;
        right: var(--r);
        overflow: visible;
      }
      .node-card-header {
        height: 34px;
        background-color: var(--el-color-primary);
        color: white;
        padding: 5px 10px;
        border-radius: var(--el-border-radius-base) var(--el-border-radius-base) 0 0;
        box-sizing: border-box;
      }
      .team .node-card-header,
      .team .node-card-header {
        background-color: var(--color-primary-light);
      }
      .node-card-body {
        flex-grow: 1;
        padding: 5px 10px;
        border-radius: 0 0 var(--el-border-radius-base) var(--el-border-radius-base);
        background-color: white;
        box-shadow: 0px 3px 6px 1px rgba(0, 0, 0, 0.16);
      }
      .node-card-expand {
        font-size: 0.5rem;
        position: absolute;
        top: 50%;
        right: calc(var(--r) * -2 - 1px);
        margin-top: calc(var(--r) * -1);
        border-radius: 14px;
        height: calc(var(--r) * 2);
        width: calc(var(--r) * 2);
        /* background-color: aqua; */
        z-index: -1;
        border-radius: 100%;
        border: 1px solid #2a6dac;
        color: #2a6dac;
        background-color: white;
        font-size: 12px;
        transform: scale(0.9);
        display: flex;
        justify-content: center;
        align-items: center;
      }
      .struct-item-preview {
        width: 50%;
        min-width: 800px;
        position: relative;
        /* box-shadow: 0 0 20px #ddd; */
      }
    </style>

    <!-- 接口配置 -->
    <script>
      window.$g.ajax.apiDoc.sq_org = {
        GetOrgNodes: {
          name: "获得组织结构",
          url: "api/sq_org/GetOrgNodes",
          method: "get",
          packagingRequest: function (param) {
            return {
              params: param,
              url: this.url,
              method: this.method
            };
          },
          packagingResponse(res) {
            res.data = ((res.data || [])[0] || []).map((item) => {
              item.$data = { ...item };
              item.dep_name = item.name;
              item.id = item.vid;
              item.pid = item.parentVid != 0 ? item.parentVid : null;
              // item.userList = ["张三", "张三", "张三"];
              return item;
            });
            return res;
          }
        },
        GetOrgNodesAndUsers: {
          name: "获得组织结构和人员",
          url: "api/sq_org/GetOrgNodesAndUsers",
          method: "get",
          packagingRequest: function (param) {
            return {
              params: param,
              url: this.url,
              method: this.method
            };
          },
          packagingResponse(res) {
            res.data = ((res.data || [])[0] || []).map((item) => {
              item.$data = { ...item };
              item.id = item.vid;
              item.pid = item.parentVid != 0 ? item.parentVid : null;
              // item.userList = ["张三", "张三", "张三"];
              return item;
            });
            return res;
          }
        },
        InsertTeam: {
          name: "添加部门的名称门",
          url: "api/sq_org/InsertTeam",
          method: "POST",
          packagingRequest: function (param) {
            return {
              params: param,
              url: this.url,
              method: this.method
            };
          },
          packagingResponse(res) {
            res.data = res.data || [];
            return res;
          }
        },
        GetGorvermentAdminById: {
          name: "根据id返回一个主管部门用户对象",
          url: "api/sq_org/GetGorvermentAdminById", //GET /api/sq_org/GetGorvermentAdminById
          method: "get",
          packagingRequest: function (param) {
            return {
              params: param,
              url: this.url,
              method: this.method
            };
          },
          packagingResponse(res) {
            res.data = (res.data || [])[0];
            return res;
          }
        },
        InsertGorvermentAdmin: {
          name: "添加一个主管部门用户对象",
          url: "api/sq_org/InsertGorvermentAdmin", //POST /api/sq_org/InsertGorvermentAdmin
          method: "POST",
          packagingRequest: function (param) {
            return {
              data: param,
              url: this.url,
              method: this.method
            };
          },
          packagingResponse(res) {
            res.data = (res.data || [])[0];
            return res;
          }
        },
        UpdateGorvermentAdmin: {
          name: "更新主管部门用户",
          url: "api/sq_org/UpdateGorvermentAdmin", //POST /api/sq_org/UpdateGorvermentAdmin
          method: "POST",
          packagingRequest: function (param) {
            return {
              data: param,
              url: this.url,
              method: this.method
            };
          },
          packagingResponse(res) {
            res.data = (res.data || [])[0];
            return res;
          }
        },
        DeleteGorvermentAdmin: {
          name: "删除主管部门用户",
          url: "api/sq_org/DeleteGorvermentAdmin", //POST /api/sq_org/DeleteGorvermentAdmin
          method: "POST",
          packagingRequest: function (param) {
            return {
              params: param,
              url: this.url,
              method: this.method
            };
          },
          packagingResponse(res) {
            res.data = (res.data || [])[0];
            return res;
          }
        }
      };
    </script>
    <!-- 页面渲染入口 -->
    <link rel="stylesheet" href="./lib/app.css" />
    <div id="app" class="abs app flex-column"></div>
    <template id="dom-app">
      <Team-Manage></Team-Manage>
    </template>
    <script>
      window.$message = ElementPlus.ElMessage;
      var App = {
        extends: BaseComponent,
        template: "#dom-app",
        components: { TeamManage }
      };
      var app = Vue.createApp(Application, { app: App }); //渲染入口
      app.use(ElementPlus, { locale: ElementPlusLocaleZhCn }); //ui库
      app.use(Application); //公共组件库
      window.$app = app;
      window.app = app.mount("#app");
    </script>
  </body>
</html>
